<?php
/*
* Kusht Mud.
* ----
* The MIT License
* Copyright (c) 2010 Andrew Tutt
* ----
*/

/* World Class
*
*
* Govern's Worldwide Game State Information (Dynamic)
* Including:
* :: Who's Logged In
* :: The list of game rooms
*/

class world {
	public static $char_list = array();
	
	// Note that this will eventually be an area of "Areas" not rooms, 
	// as the world is simply too big for one big list of rooms
	public static $room_list = array();
	
	public static function get_char_world($queryinguser,$targetstr) {
		$userinroom = $queryinguser->in_room->get_char_room($queryinguser, $targetstr);
		if ($userinroom) {
			return $userinroom;
		}
		
		foreach(world::$char_list as $char) {
			if (stripos($char->name,$targetstr)!==FALSE) { return $char; }
		}
		
		return FALSE;
	}
	
	// These will eventually throw off a trigger to update the global "who" list
	public static function add_char_to_world($user) {
		array_push(world::$char_list,$user);
	}
	
	public static function rmv_char_from_world($user) {
		array_del_elem(world::$char_list,$user);
	}
	
}

?>